import request from '@/utils/request'

export function getRoleList(params) {
  return request({ url: '/online/authorization/role', params, method: 'GET'
  })
}

export function getAllRole(params) {
  return request({
    url: '/online/authorization/role/list',
    params,
    method: 'GET'
  })
}

export function roleInfo(roleId) {
  return request({ url: `/online/authorization/role/${roleId}`, method: 'GET'
  })
}

export function newRole(data) {
  return request({ url: `/online/authorization/role`, data, method: 'POST'
  })
}

export function updateRole(data) {
  return request({ url: `/online/authorization/role/${data.roleId}`, data, method: 'POST'
  })
}

export function deleteRole(roleId) {
  return request({ url: `/online/authorization/role/${roleId}`, method: 'DELETE'
  })
}

export function getRoleMenuFunctions(roleId) {
  return request({ url: `/online/authorization/role/${roleId}/menu-functions`, method: 'GET'
  })
}

export function listRole(params) {
  return request({ url: `/online/authorization/role/list`, method: 'GET', params
  })
}

export function listModule(params) {
  return request({
    url: `/online/authorization/role/list`,
    method: 'GET',
    params
  })
}
